/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.shoppingsystem.view.validators;

import java.io.File;

/**
 *
 * @author victor
 */
public class FiltroImagen extends javax.swing.filechooser.FileFilter {

    private final static String[] aceptadas = {".jpg", ".png", ".gif"};

    @Override
    public boolean accept(File pathname) {
        if (pathname.isDirectory()) {
            return true;
        } else {
            for (String extension : aceptadas) {
                if (pathname.getName().toLowerCase().endsWith(extension)) {
                    return true;
                }
            }
        }
        return false;
    }

    @Override
    public String getDescription() {
        return "Imágenes (*.gif, *.jpg, *.png)";
    }

}
